<include file="Public/mobile_head"/>
<link href="{:ADDON_PUBLIC_PATH}/blconn.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/layer/layer.m.js"></script>
<body>
    <div class="container">
        <!-- 头部 -->
        <div class="exchangeHeader">
            <div class="back"><a href="#"><i class="icon-keyboard_arrow_left"></i></a></div>
            <div class="title">积分兑换</div>
        </div>
        <!-- 内容 -->
        <div class="exchangeBanner">
            <div class="exchangeScore">
                <div>当前可用积分</div>
                <span>{$myInfo.score}</span>
            </div>
            <div class="exchangeScore">
                <div>已兑换现金</div>
                <span>{$myInfo.redPackAmount}</span>元
            </div>
        </div>
        <div class="exchangeWarp">
            <form method="post">
                <div class="tile">金额</div>
                <div class="selectMoney clearfix">
                    <span money="10" class="active">10元</span>
                    <span money="50">50元</span>
                    <span money="100">100元</span>
                    <span money="200">200元</span>
                </div>
                <p class="text-right needScore">所需积分：<span>1000</span></p>

                <div class="button">
                    <input type="hidden" name="money" value="10">
                    <input type="submit" value="确认兑换">
                </div>

                <div class="tips">
                    <p style="font-weight: 900;">温馨提示</p>
                    <p>1、每天凌晨0：00-8：00为结算时间，此段时间网站暂停积分兑换。</p>
                    <p>2、兑换的现金将以微信红包形式返回，请及时领取。</p>
                </div>
            </form>
        </div>
        <div class="shade hide">
        </div>
    </div>
</body>
<script>
	$(function(){
		$(".selectMoney span").click(function(){
			$(this).addClass("active").siblings("span").removeClass();
            $("input[name='money']").val($(this).attr("money"));
            $(".needScore>span").text($(this).attr("money") * 100);
		});

        $("input[type='submit']").click(function(){
            var myDate = new Date();
            var currentHour = myDate.getHours();

            if(0 <= currentHour && currentHour < 8) {
                layer.msg('0：00-8：00时段不可进行兑换');
                return false;
            }

            var money = $("input[name='money']").val();
            if(money * 100 > '{$myInfo.score}') {
                layer.msg('您的积分不足');
                return false;
            }
        });
	});

    function showMsg(msg) {
        layer.open({
            content: msg,
            style: 'background-color:rgba(0,0,0,0.6); color:#fff; border:none;',
            time: 2
        });
    }
</script>
</html>